package net.adetech.crj.controller;

import com.alibaba.fastjson.JSON;
import net.adetech.crj.entity.User;
import net.adetech.crj.utils.ServiceUtil;
import net.adetech.framework.entity.ServiceResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
public class PaperServiceController {
    @Autowired
    ServiceUtil serviceUtil;


    @RequestMapping(value = "/paper/list",produces = "application/json")
    public String getPaperList(HttpSession session)
    {
        User user = (User)session.getAttribute("currentUser");
        String sfzh = user.getIdNumber();

        ServiceResponse serviceResponse = serviceUtil.callService("paper.getListBySfzh","sfzh",sfzh);
        return JSON.toJSONString(serviceResponse.getResults().get("paperList"));

    }


    @RequestMapping(value = "/paper/progressList",produces = "application/json")
    public String getPaperProgressList(HttpSession session)
    {
        User user = (User)session.getAttribute("currentUser");
        String sfzh = user.getIdNumber();

        ServiceResponse serviceResponse = serviceUtil.callService("paper.getProgressListBySfzh","sfzh",sfzh);
        return JSON.toJSONString(serviceResponse.getResults().get("progressList"));

    }

    @RequestMapping(value = "/paper/queryProgress",produces = "application/json")
    public String queryProgress(String ywbh)
    {
        ServiceResponse serviceResponse = serviceUtil.callService("paper.getProgressListByYwbh","ywbh",ywbh);
        return JSON.toJSONString(serviceResponse.getResults().get("progressList"));

    }


}
